1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#![allow(non_camel_case_types, non_snake_case)]

use crate::decl::*;
use crate::kernel::ffi_types::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::vt::*;

/// [`IFilterGraph2`](crate::IFilterGraph2) virtual table.
#[repr(C)]
pub struct IFilterGraph2VT {
	pub IGraphBuilderVT: IGraphBuilderVT,
	pub AddSourceFilterForMoniker: fn(COMPTR, COMPTR, COMPTR, PCSTR, *mut COMPTR) -> HRES,
	pub ReconnectEx: fn(COMPTR, COMPTR, PCVOID) -> HRES,
	pub RenderEx: fn(COMPTR, COMPTR, u32, *mut u32) -> HRES,
}

com_interface! { IFilterGraph2: "36b73882-c2c8-11cf-8b46-00805f6cef60";
	/// [`IFilterGraph2`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nn-strmif-ifiltergraph2)
	/// COM interface over [`IFilterGraph2VT`](crate::vt::IFilterGraph2VT).
	///
	/// Automatically calls
	/// [`IUnknown::Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
	/// when the object goes out of scope.
}

impl dshow_IFilterGraph for IFilterGraph2 {}
impl dshow_IGraphBuilder for IFilterGraph2 {}
impl dshow_IFilterGraph2 for IFilterGraph2 {}

/// This trait is enabled with the `dshow` feature, and provides methods for
/// [`IFilterGraph2`](crate::IFilterGraph2).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait dshow_IFilterGraph2: dshow_IGraphBuilder {
	/// [`IFilterGraph2::ReconnectEx`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-ifiltergraph2-reconnectex)
	/// method.
	fn ReconnectEx(&self,
		pin: &impl dshow_IPin,
		mt: Option<&AM_MEDIA_TYPE>,
	) -> HrResult<()>
	{
		ok_to_hrresult(
			unsafe {
				(vt::<IFilterGraph2VT>(self).ReconnectEx)(
					self.ptr(),
					pin.ptr(),
					mt.map_or(std::ptr::null_mut(), |mt| mt as *const _ as _),
				)
			},
		)
	}
}